<template>
  <laker-dialog
    v-model="visible"
    title="风险分析"
    width="900"
    height="900"
    :show-fullscreen="true"
    :show-close="true"
    destroy-on-close
    @closed="$emit('closed')"
    @setFullscreen="setFullscreen"
  >
    <div :class="elmain">
      <div class="elheader">
        <div class="elheader_title">
          <div>今日安全风险提示</div>
          <div class="elheader_time">{{ today }}</div>
        </div>
        <div class="elheader_title">今日公司重大级风险共计{{ risk01 }}个</div>
        <div class="elheader_title">
          <div>应急电话:</div>
          <div class="elheader_tel">
            <div>0476-6189666</div>
            <div>0476-6189777</div>
          </div>
        </div>
      </div>
      <div class="elbody">
        <div class="elbody_left">
          <div class="fxmc">
            作业任务名称：<br />
            1号炉1A1B引风机入口膨张节漏烟气检查处理
          </div>
          <div :class="dataModel.fxdj">
            风险等级：重大风险<br />
            管控级别：公司级
          </div>
          <div>作业区域：</div>
          <div>
            <div>危害因素：</div>
            <div class="whys">
              <div v-for="(item, index) in dataModel.whys" :class="item.fxdj" :key="index">{{ item.name }}</div>
            </div>
          </div>
          <div class="fxfzr">
            <div>作业负责人：</div>
            <div>作业组人数：3人</div>
          </div>
        </div>
        <div class="elbody_main">
          <div>防范措施：<br />{{ dataModel.ffcs }}</div>
          <div class="videodiv"><video muted autoplay id="=flvBlock"></video></div>
        </div>
      </div>
    </div>
  </laker-dialog>
</template>

<script>
import LakerDialog from '@/components/lakerDialog/index.vue'
import { dayjs } from 'element-plus'

export default {
  name: 'RiskAnalysisDialog',
  components: { LakerDialog },
  emits: ['success', 'closed'],
  data() {
    return {
      mode: 'add',
      visible: false,
      titleMap: {
        add: '选择设备类型',
        edit: '编辑人员',
        show: '查看'
      },
      elmain: 'elmain',
      today: dayjs().format('YYYY-MM-DD'),
      risk01: 0,
      dataModel: {
        fxdj: 'VH',
        ffcs:
          '高处坠落：' +
          '1.安全带不得系挂在移动或不牢固的构件上,没有车固的构件悬挂安全带时,必须拉设安全绳。' +
          '2.使用安全带时应高挂低用。' +
          '3.作业使用的安全带无破损。' +
          '4.高处作业落差超过5m时,必须使用防坠器。距离坠落基准面10米及以上(包括脚手架搭、拆作业)、无法搭设脚手架或无固定作业平台的高处进行的作业功理一级高风险许可证。'+
          '5.在石棉瓦、瓦檩板等轻型材料上作业,应搭设并站在固定承重板上作业',
        whys: [
          { fxdj: 'N', name: '触电' },
          { fxdj: 'L', name: '烫伤' },
          { fxdj: 'N', name: '火灾' },
          { fxdj: 'L', name: '淹溺' },
          { fxdj: 'L', name: '坍塌' },
          { fxdj: 'L', name: '透水' },
          { fxdj: 'L', name: '物体打击' },
          { fxdj: 'N', name: '车辆伤害' },
          { fxdj: 'N', name: '机械伤害' },
          { fxdj: 'H', name: '起重伤害' },
          { fxdj: 'VH', name: '高处坠落' }
        ]
      }
    }
  },
  methods: {
    //显示
    open(mode = 'add') {
      this.mode = mode
      this.visible = true
      console.log(this.visible)
      return this
    },
    close() {
      this.visible = false
      return this
    },
    //表单注入数据
    setData(data) {
      console.log(data)
    },
    setFullscreen(isFullscreen) {
      if (isFullscreen) {
        this.elmain = 'elmainmax'
      } else {
        this.elmain = 'elmain'
      }
    }
  }
}
</script>

<style scoped lang="scss">
.elmain {
  height: 500px;
  background-image: url('@/assets/dprevent/spicppt.png');
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  flex-direction: column;
  color: black;
  .elheader {
    margin-left: 10px;
    margin-right: 120px;
    height: 90px;
    display: flex;
    justify-items: center;
    align-items: center;
  }
  .elbody {
    margin: 5px;
    height: 380px;
    display: flex;
    flex-direction: row;
    justify-items: center;
    align-items: center;
    border: 1px solid red;
  }
}
.elmainmax {
  height: calc(100vh - 100px);
  background-image: url('@/assets/dprevent/spicppt.png');
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  flex-direction: column;
  .elheader {
    margin-left: 10px;
    margin-right: 250px;
    height: 120px;
    display: flex;
    justify-content: space-between;
    justify-items: center;
    align-items: center;
  }
  .elbody {
    margin: 10px;
    height: calc(100% - 150px);
    display: flex;
    flex-direction: row;
    justify-items: center;
    align-items: center;
    border: 1px solid red;
  }
}

.elheader_title {
  display: flex;
  margin-left: 10px;
  justify-content: center;
  align-items: center;
  color: red;
  font-size: 20px;
  font-weight: bold;
}

.elheader_time {
  margin-left: 10px;
  justify-content: center;
  align-items: center;
  color: rgb(112, 48, 160);
  font-size: 16px;
  font-weight: bold;
}

.elheader_tel {
  margin-left: 10px;
  justify-content: center;
  align-items: center;
  color: red;
  font-size: 12px;
  font-weight: bold;
}

.elbody_left {
  width: 35%;
  height: 100%;
  border: 1px solid red;
  margin: 5px;
  div {
    margin: 2px;
    border-bottom: 1px solid silver;
  }
}
.elbody_main {
  width: 64%;
  height: 100%;
  border: 1px solid green;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.fxfzr {
  display: flex;
  justify-content: space-between;
}

.whys {
  display: flex;
  flex-wrap: wrap;
  div {
    width: 30%;
    border: 1px solid silver;
    text-align: center;
  }
}
.VH {
  background-color: #ff0000;
  color: black;
}

.H {
  background-color: #ff7d00;
  color: black;
}

.N {
  background-color: #ffff00;
  color: black;
}

.L {
  background-color: skyblue;
  color: white;
}

.videodiv {
  width: 120px;
  height: 90px;
  border: 1px solid silver;
}
</style>
